//
//  WJQUserInfoTableViewCell.m
//  TripTogether
//
//  Created by dllo on 16/1/3.
//  Copyright © 2016年 王军岐. All rights reserved.
//

#import "WJQUserInfoTableViewCell.h"


@interface WJQUserInfoTableViewCell ()

@property (nonatomic, strong) UILabel *titleL;
@property (nonatomic, strong) UILabel *subTitleL;
@property (nonatomic, strong) UIImageView *headImageV;

@end




@implementation WJQUserInfoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
- (void)createSubViews
{
    _titleL = [UILabel new];
//    _titleL.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:_titleL];

    [_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.width.mas_equalTo(@100);
        make.height.equalTo(self.contentView);
        make.left.mas_equalTo(@20);
        make.top.mas_equalTo(@0);
    }];
    
    _subTitleL = [UILabel new];
//    _subTitleL.backgroundColor = [UIColor brownColor];
    _subTitleL.textAlignment = NSTextAlignmentRight;
    _subTitleL.hidden = YES;
    [self.contentView addSubview:_subTitleL];
    
    [_subTitleL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(@(-15));
        make.height.mas_equalTo(_titleL.mas_height);
        make.left.mas_equalTo(_titleL.mas_right);

    }];
    
    _headImageV = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 70 - 40, 15, 70, 70)];
    _headImageV.backgroundColor = [UIColor orangeColor];
    _headImageV.layer.masksToBounds = YES;
    _headImageV.hidden = NO;
    _headImageV.layer.cornerRadius = _headImageV.frame.size.width / 2.f;
    [self.contentView addSubview:_headImageV];

}
- (void)setInfoValueTitle:(NSString *)title subTitle:(NSString *)subTitle isImageURL:(BOOL)isImageURL
{
    _titleL.text = title;
    
    if (isImageURL) {
        _headImageV.hidden = NO;
        _subTitleL.hidden = YES;
        
        
        [_headImageV sd_setImageWithURL:[NSURL URLWithString:subTitle] placeholderImage:PICHOLDEER];
        
    } else {
        _headImageV.hidden = YES;
        _subTitleL.hidden = NO;
        
        _subTitleL.text = subTitle;
    }
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
